#ifndef t_xml_h
#define t_xml_h
/*
 * Sylvain BERTRAND <digital.ragnarok@gmail.com>
 * code protected by GNU GPL v3
 */
G_BEGIN_DECLS
typedef void (*t_xml_callback) (xmlNodePtr node, gpointer data);
struct t_xml_inst {
	gint ref;
	struct t_paths *xdg_paths;
	GHashTable *callbacks;
	xmlDocPtr doc;
	xmlNodePtr root;
	gchar *path;
};
struct t_xml_inst *t_xml_instance_new(void);
void t_xml_instance_unref(struct t_xml_inst *inst);
gboolean t_xml_load_file(struct t_xml_inst *inst, const gchar *path, const gchar *root_node);
gboolean t_xml_load_config_file(struct t_xml_inst *inst, const gchar *domain, const gchar *filename,
	const gchar *root_node);
void t_xml_close(struct t_xml_inst *inst);
xmlNodePtr t_xml_root(struct t_xml_inst *inst);
void t_xml_register(struct t_xml_inst *inst, const gchar *tag, t_xml_callback func, gpointer data);
void t_xml_tree(struct t_xml_inst *i, xmlNodePtr node);
void t_xml_tree_from_root(struct t_xml_inst *i);
xmlNodePtr t_xml_find_node(xmlNodePtr node, const gchar *name);
gboolean t_xml_node_contains(xmlNodePtr node, const gchar *val);
gchar *t_xml_node_string(xmlNodePtr node);
gint t_xml_node_int(xmlNodePtr node);
gboolean t_xml_node_bool(xmlNodePtr node);
gboolean t_xml_attr_contains(xmlNodePtr node, const gchar *name, const gchar *val);
gboolean t_xml_attr_string(xmlNodePtr node, const gchar *name, gchar **value);
gboolean t_xml_attr_bool(xmlNodePtr node, const gchar *name, gboolean *value);
G_END_DECLS
#endif
